import { RewardFactory } from '../../model/reward/factory';
import { ConditionFactory } from '../../systems/condition-checker/factory';
import {
  SECT_JOB,
  SECT_JOB_NUMBER,
  SECT_TAG,
  SECT_TASK_TYPE,
  type SectTaskConfig,
} from './type';

export const SECT_TASK_ID = {
  /** 照看丹炉 */
  LIAN_DAN_HANG_UP_01: 'LIAN_DAN_HANG_UP_01',
  /** 灵草培育 */
  LIAN_DAN_HANG_UP_02: 'LIAN_DAN_HANG_UP_02',

  /** 维护器炉 */
  LIAN_QI_HANG_UP_01: 'LIAN_QI_HANG_UP_01',
  /** 精炼矿石 */
  LIAN_QI_HANG_UP_02: 'LIAN_QI_HANG_UP_02',

  /** 打扫宗门 */
  COMMON_HANG_UP_01: 'COMMON_HANG_UP_01',
  /** 采集灵材 */
  COMMON_NORMAL_01: 'COMMON_NORMAL_01',
};

export const LIAN_DAN_SECT_TASKS: SectTaskConfig[] = [
  {
    id: SECT_TASK_ID.LIAN_DAN_HANG_UP_01,
    name: '照看丹炉',
    description: '负责照看宗门丹炉，维持火候稳定，确保炼丹过程顺利进行',
    type: SECT_TASK_TYPE.HANG_UP,
    tag: SECT_TAG.LIAN_DAN,
    baseReward: [
      RewardFactory.createSectContributionReward({
        quantity: 10,
      }),
      RewardFactory.createSpiritStoneReward({
        quantity: 5,
      }),
    ],
    receiveConditions: [
      ConditionFactory.createSectJobCondition(
        SECT_JOB_NUMBER[SECT_JOB.TRUE_DISCIPLE]
      ),
    ],
  },
  {
    id: SECT_TASK_ID.LIAN_DAN_HANG_UP_02,
    name: '灵草培育',
    description: '在灵草园培育炼丹所需的各类灵草，定期照料',
    type: SECT_TASK_TYPE.HANG_UP,
    tag: SECT_TAG.LIAN_DAN,
    baseReward: [
      RewardFactory.createSectContributionReward({
        quantity: 15,
      }),
      RewardFactory.createSpiritStoneReward({
        quantity: 8,
      }),
    ],
    receiveConditions: [
      ConditionFactory.createSectJobCondition(
        SECT_JOB_NUMBER[SECT_JOB.MANAGER]
      ),
    ],
  },
  // {
  //   id: 'alchemy_normal_01',
  //   name: '炼制聚气丹',
  //   description: '为宗门炼制一批聚气丹，供外门弟子修炼使用',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.LIAN_DAN,
  //   baseReward: [
  //     { poolId: 'sect_contribution', amount: 50 },
  //     { poolId: 'spirit_stones', amount: 30 },
  //     { poolId: 'qi_gathering_pill', amount: 2 }
  //   ],
  //   conditions: [
  //     { type: 'CRAFT_ITEM', value: 'qi_gathering_pill', count: 10 }
  //   ],
  //   receiveConditions: [
  //     { type: 'SECT_JOB', value: SECT_JOB.INNER_DISCIPLE },
  //     { type: 'ALCHEMY_LEVEL', value: 2 }
  //   ]
  // },
  // {
  //   id: 'alchemy_normal_02',
  //   name: '炼制筑基丹',
  //   description: '炼制珍贵的筑基丹，帮助同门突破筑基期',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.LIAN_DAN,
  //   baseReward: [
  //     { poolId: 'sect_contribution', amount: 200 },
  //     { poolId: 'spirit_stones', amount: 100 },
  //     { poolId: 'foundation_pill', amount: 1 }
  //   ],
  //   conditions: [
  //     { type: 'CRAFT_ITEM', value: 'foundation_pill', count: 3 }
  //   ],
  //   receiveConditions: [
  //     { type: 'SECT_JOB', value: SECT_JOB.TRUE_DISCIPLE },
  //     { type: 'ALCHEMY_LEVEL', value: 5 }
  //   ]
  // },
  // {
  //   id: 'alchemy_normal_03',
  //   name: '改良丹方',
  //   description: '研究并改良宗门传承丹方，提升丹药效果',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.LIAN_DAN,
  //   baseReward: [
  //     { poolId: 'sect_contribution', amount: 500 },
  //     { poolId: 'spirit_stones', amount: 300 },
  //     { poolId: 'rare_herbs', amount: 5 }
  //   ],
  //   conditions: [
  //     { type: 'RESEARCH_RECIPE', value: 'any', count: 1 }
  //   ],
  //   receiveConditions: [
  //     { type: 'SECT_JOB', value: SECT_JOB.ELDER },
  //     { type: 'ALCHEMY_LEVEL', value: 8 }
  //   ]
  // }
];

export const LIAN_QI_SECT_TASKS: SectTaskConfig[] = [
  {
    id: SECT_TASK_ID.LIAN_QI_HANG_UP_01,
    name: '维护器炉',
    description: '定期维护炼器炉，清理炉渣，保持器炉最佳状态',
    type: SECT_TASK_TYPE.HANG_UP,
    tag: SECT_TAG.LIAN_QI,
    baseReward: [
      RewardFactory.createSectContributionReward({
        quantity: 12,
      }),
      RewardFactory.createSpiritStoneReward({
        quantity: 6,
      }),
    ],
    receiveConditions: [
      ConditionFactory.createSectJobCondition(
        SECT_JOB_NUMBER[SECT_JOB.TRUE_DISCIPLE]
      ),
    ],
  },
  {
    id: SECT_TASK_ID.LIAN_QI_HANG_UP_02,
    name: '精炼灵矿',
    description: '将粗灵矿精炼为纯净的炼器材料',
    type: SECT_TASK_TYPE.HANG_UP,
    tag: SECT_TAG.LIAN_QI,
    baseReward: [
      RewardFactory.createSectContributionReward({
        quantity: 18,
      }),
      RewardFactory.createSpiritStoneReward({
        quantity: 10,
      }),
    ],
    receiveConditions: [
      ConditionFactory.createSectJobCondition(
        SECT_JOB_NUMBER[SECT_JOB.MANAGER]
      ),
    ],
  },

  // // 普通任务
  // {
  //   id: 'forging_normal_01',
  //   name: '炼制飞剑',
  //   description: '为宗门炼制一批制式飞剑，供弟子使用',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.LIAN_QI,
  //   baseReward: [
  //     { poolId: 'sect_contribution', amount: 60 },
  //     { poolId: 'spirit_stones', amount: 40 },
  //     { poolId: 'flying_sword', amount: 1 }
  //   ],
  //   conditions: [
  //     { type: 'CRAFT_ITEM', value: 'flying_sword', count: 5 }
  //   ],
  //   receiveConditions: [
  //     { type: 'SECT_JOB', value: SECT_JOB.INNER_DISCIPLE },
  //     { type: 'FORGING_LEVEL', value: 2 }
  //   ]
  // },
  // {
  //   id: 'forging_normal_02',
  //   name: '炼制护身法宝',
  //   description: '炼制具有防护功能的法宝，增强宗门防御力量',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.LIAN_QI,
  //   baseReward: [
  //     { poolId: 'sect_contribution', amount: 300 },
  //     { poolId: 'spirit_stones', amount: 150 },
  //     { poolId: 'defense_talisman', amount: 1 }
  //   ],
  //   conditions: [
  //     { type: 'CRAFT_ITEM', value: 'defense_talisman', count: 2 }
  //   ],
  //   receiveConditions: [
  //     { type: 'SECT_JOB', value: SECT_JOB.TRUE_DISCIPLE },
  //     { type: 'FORGING_LEVEL', value: 6 }
  //   ]
  // },
  // {
  //   id: 'forging_normal_03',
  //   name: '修复古宝',
  //   description: '修复宗门传承的古宝，恢复其往日威能',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.LIAN_QI,
  //   baseReward: [
  //     { poolId: 'sect_contribution', amount: 800 },
  //     { poolId: 'spirit_stones', amount: 500 },
  //     { poolId: 'ancient_artifact', amount: 1 }
  //   ],
  //   conditions: [
  //     { type: 'REPAIR_ITEM', value: 'ancient_artifact', count: 1 }
  //   ],
  //   receiveConditions: [
  //     { type: 'SECT_JOB', value: SECT_JOB.SUPER_ELDER },
  //     { type: 'FORGING_LEVEL', value: 9 }
  //   ]
  // }
];

export const COMMON_SECT_TASKS: SectTaskConfig[] = [
  {
    id: SECT_TASK_ID.COMMON_HANG_UP_01,
    name: '打扫宗门',
    description: '负责打扫宗门各处，保持环境整洁',
    type: SECT_TASK_TYPE.HANG_UP,
    tag: SECT_TAG.COMMON,
    baseReward: [
      RewardFactory.createSectContributionReward({
        quantity: 8,
      }),
      RewardFactory.createSpiritStoneReward({
        quantity: 4,
      }),
    ],
    receiveConditions: [
      ConditionFactory.createSectJobCondition(
        SECT_JOB_NUMBER[SECT_JOB.OUTER_SERVANT]
      ),
    ],
  },
  // {
  //   id: SECT_TASK_ID.COMMON_NORMAL_01,
  //   name: '采集灵材',
  //   description: '前往宗门附近的灵山采集炼丹/炼器所需的材料',
  //   type: SECT_TASK_TYPE.NORMAL,
  //   tag: SECT_TAG.COMMON,
  //   baseReward: [
  //     RewardFactory.createSectContributionReward({
  //       quantity: 40,
  //     }),
  //     RewardFactory.createSpiritStoneReward({
  //       quantity: 25,
  //     }),
  //   ],
  //   conditions: [],
  //   receiveConditions: [
  //     ConditionFactory.createSectJobCondition(
  //       SECT_JOB_NUMBER[SECT_JOB.OUTER_DISCIPLE]
  //     ),
  //   ],
  // },
];
